package com.mall507.fivepeaks.activity.mine;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.hzh.frame.ui.activity.AbsRecyclerViewUI;
import com.hzh.frame.widget.xrecyclerview.RecyclerViewHolder;
import com.mall507.comn.model.MineOnWeAgreement;
import com.mall507.comn.model.MineProblem;
import com.mall507.fivepeaks.R;
import com.mall507.fivepeaks.widget.imageview.CircleImageView;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * @author
 * @version 1.0
 * @date 2019/8/27
 */
@Route(path = "/mine/OnWeAgreementRUI")
public class OnWeAgreementRUI extends AbsRecyclerViewUI<MineOnWeAgreement>{

    @Override
    protected int setLayoutId() {
        return R.layout.ui_rv_mine_onwe_agreement;
    }

    @Override
    protected void bindView() {
        getTitleView().setContent("服务协议");
    }
    
    @Override
    protected String setHttpPath() {
        return "json/MineOnWeAgreement.json";
    }

    @Override
    protected List<MineOnWeAgreement> handleHttpData(JSONObject response) {
        List<MineOnWeAgreement> list = new ArrayList<>();
        if(1==response.optInt("code")){
            JSONArray jsonArray=response.optJSONArray("list");
            for(int i=0;i<jsonArray.length();i++){
                JSONObject object=jsonArray.optJSONObject(i);
                MineOnWeAgreement model=new MineOnWeAgreement();
                model.setTitle(object.optString("title"));
                model.setContent(object.optString("content"));
                list.add(model);
            }
        }
        return list;
    }

    @Override
    protected int setItemLayoutId(int viewType) {
        return R.layout.item_rv_mine_onwe_agreement;
    }

    @Override
    protected void bindItemData(RecyclerViewHolder holder, int position, MineOnWeAgreement model) {
//        holder.setText(R.id.title, model.getTitle());
//        holder.setText(R.id.content, "\u3000\u3000" + model.getContent());
    }
}
